package com.romanito.andiview;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;

public class Preferences extends PreferenceActivity {
	
	static private int _invertPanning;
	static private String _transitions;

	public static int getInvertPanning() {
		return _invertPanning;
	}
	
	public static String getTransitions() {
		return _transitions;
	}
	
	public static void load(Context context) {
		SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
		_invertPanning = prefs.getBoolean("pref_invert_panning", false) ? 1 : -1;
		_transitions = prefs.getString("pref_transitions", "slide");
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		addPreferencesFromResource(R.xml.preferences);
	}

	@Override
	protected void onStop() {
		Preferences.load(getApplicationContext());
		super.onStop();
	}

}
